package PTA.javaB;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class ex16 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<E> e = new ArrayList<>();
int n = sc.nextInt();
for(int i=0;i<n;i++){
    String name = sc.nextLine();
    String s= sc.nextLine();
    int age = Integer.parseInt(s);
    E a = new E(name,age);

    e.add(a);
}
        for (int i = 0; i < e.size()-1; i++) {
            for (int j = i + 1; j < e.size(); j++) {
                if (e.get(i).equals(e.get(j))) {
                    e.remove(j);
                    j--;
                }
            }
        }

        System.out.println(e);




    }
}
class E{
     private String name;
    private int age;
public E(String name,int age){
if(name=="null"){
    this.name = null;
}else{
    this.name=name;
}

this.age=age;
}
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if(o instanceof E)
        {
            E p = (E)o;

            if (this.getName().equalsIgnoreCase(p.getName()) &&(this.getAge() == p.getAge()))

            {
                return true;
            }
            else if(this.getName()==null&&p.getName()==null&&this.getAge()==p.getAge())
            {
                return true;
            }

        }
        return false;
}


    @Override
    public String toString() {
        return "Person "+"[name="+this.name+", age="+this.age+"]";
    }

}